Installation
Follow the steps below to get started with your Site Template:
- Unzip the downloaded zip file
nairobi-xxxxx.zipfolder - Open folder named
main-fileFollow the steps below to set up your React application:
-
Install packages:
npm i -
Start the development server:
npm startThe app will open in your default browser at
http://localhost:3000. -
To build your React application for production:
npm run buildThis will create an optimized production build in the
builddirectory.
-
- Here you will find
srcfolders of all files - Make sure you upload the required files/folders listed below:
-
- Followings are files and sub-folders saved in this folder
styles- Extra Stylesheets Folder plus Main Stylesheet Fileimages- Images Foldercomponents- Include all components and File
- You're now good to go..! Start adding your Content and show off your Brand New Beautiful Website in style.
HTML Structure
Nairobi follows a simple coding structure. here is the sample:
<!DOCTYPE html> <html lang="en" dir="ltr"> <!-- All your metas will be here --> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <head> <!-- Your Stylesheets, Title --> ... </head> <body> <noscript>You need to enable JavaScript to run this app.<noscript> <div id="root"></div> .... </div> </body> </html>
Favicons
You can add a Favicon to your Website using the following code just bottom to the meta tag:
<link rel="icon" href="%PUBLIC_URL%/favicon.png"/>
React Structure
Nairobi follows a simple coding react structure. here is the sample:
-
you will find
srcfolders of all files.
// Import React and ReactDOM
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { BrowserRouter } from "react-router-dom";
import reportWebVitals from "./reportWebVitals";
// Create a root entry point for ReactDOM
const root = ReactDOM.createRoot(document.getElementById("root"));
// Render your React app inside the root element
root.render(
<React.StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>
);
-
How
Routingworks?.
import { Route, Routes } from "react-router-dom";
import "./App.css";
import "./styles/colijala.css";
import "./styles/homeMedia.css";
import "./styles/news_single.css";
import "./styles/news.css";
import "./styles/slick-theme.css";
import "./styles/style.css";
import Home from "./components/Home";
import Colijala from "./components/Colijala";
import News from "./components/News.jsx";
import NewsSingle from "./components/NewsSingle.jsx";
<div className="App">
<Routes>
<Route path="/" element="<Home />" />
<Route path="/colijala" element="<Colijala />" />
<Route path="/news" element="<News />" />
<Route path="/news_single" element="<NewsSingle />" />
</Routes>
</div>
-
You will find whole components in the
componentsfolder.-
Inside the
componentsfolder, you'll find:- The
colijalafolder. - The
homefolder. - The
newsfolder. - Other respective sidebar and footer files.
- The
-
Inside the
Page Loading Transitions
You can show Interactive loaders to your Visitors while the Pages of your Website loads in the
background & then Reveal show Interactive loaders to your Visitors while your Pages with CSS3
Transitions. Page Loading Transitions are enabled by default. To disable the Transition, you can
simply remove .preloader Class just after the <body> Tag.
<div className="preloader"> <div className="loader"> ... </div> </div>
Logo Settings
The Logo Container can be found in the Header Container - header tag
import headerLogo from "../../assets/img/svg/logo.svg";
<div className="logo-main"> <Link to="/"> <img src={headerLogo} alt="Nairobi Header Logo" className="img-fluid" /> </Link> </div>
Changing Fonts
Change your Fonts from Google Fonts Library directly if you plan to use a Google Font. You can find
the Linking to the Font
Files in the head tag
<link href="https://fonts.googleapis.com/css2?family=Fascinate&family=Jost:wght@400;500&display=swap" rel="stylesheet">
In order to change the Fonts, you will need to Edit the Above Links with your Custom Font, if you plan to use a Google Font or Remove it completely if you plan to use a Self Hosted font. Here is an Example for using Self Hosted Fonts.
By default, Nairobi uses one Font namely: Jost and Montserrat from the Google Fonts Library
Website Optimization Tips
A Fast & Optimized Website has several factors which needs to be implemented in order to achieve the desired results. There are several Optimization Techniques available which will definitely affect your Website's Performance in a Positive Way & we want to share a few of them with you:
-
Image Compression & Optimization
We tend to use Lots of Images on our Websites but we often do not make efforts to Compress & Optimize them. Remember, the Larger the Image, the more time it takes to download and therefore this slows your website loading times affecting User Experience. Your customer will leave your website if it does not load within 3-5 Seconds which adversely affects your Sales. Therefore, it is important to Resize, Optimize & Compress your Images before using it on your Website. Here are some Tips which might come handy in optimizing images:
- Resize your Images: Resize your Images before using it on your Website. Do
not just Download an Image & place it as it is in your Website's
<img>Tag without resizing it. The size/resolution of the Image matters since it is not recommended to use an Image size of1200pxx800pxin a Content Size of300pxx200pxas this is unnecessary. Resize it to300pxx200px - Image Formats: There are three common file types that are used for web images which are JPEG, GIF, & PNG. For images with a Flat Background use JPEG images, for images with a Transparent background use PNG images and for images with Animations use GIF images.
- Compressing Images: Images Compression is important as it considerably
reduces the size without losing the quality. There are several FREE Image Optimization Tools
available to Download.
For MAC use ImageOptim
For Windows use Riot for compressing JPEG Images & PNG Gauntlet for PNG Images.
- Resize your Images: Resize your Images before using it on your Website. Do
not just Download an Image & place it as it is in your Website's
-
CSS & jQuery Minifications
It is also recommended that you Combine & Minify all your CSS Files to a single CSS File & all Javascript Files to a single JS File since Minification reduces the size of the File and Combining the files helps in reducing the number of HTTP requests made to the server. This is also an Important Factor in increasing the speed of your website. There are several tools available online to Minify your CSS & JS Files. Our recommendations are:
For CSS use CSS Minifier and For Javascript use Javascript Minifier. -
Fast Web Hosting Servers
A lot depends on your Web Hosting Servers, so it is recommended that you choose a Hosting Company/Server that provides a Reliable & a Fast Hosting Service. You can check out some recommended Hosting Services here: http://themeforest.net/get_hosting.
Header
You can choose the headers while creating your Pages. Default Header with a Transparent Background
while turns Stickey after a little scrolling &,you can make header without stickey effect for
this
just remove the #header from the header tag.
Simply follow the structure below to create the header:
<!-- Start Navbar header -->
<header className="menu">
<div className="logo_main"">
<div className="nav-item">
...
</div>
</div>
</header>
Components
Slider Structure
Nairobi refer a React simple slider structure.
<!-- Slider Structure -->
<section className="slider slider-style" id="home">
<Swiper {...params}>
<div className="swiper-slide">
{/* Slide content */}
...
</div>
<div className="swiper-slide">
{/* Slide content */}
...
</div>
</div>
</Swiper>
</section>
Counter
Use the below code to display counter.
<!-- Counter Structure -->
<div class="digit" id="counter">
<h4 class="eight-digit count percent" data-count="8">
...
</h4">
</div>
Tabs Structure
Nairobi use React tabs but when you use a slider in tabs, you should add menu_nav to
the tab's wrapper.
<!-- Tabs navs --> <div className="tab_box" data-aos="fade-up"> <button className="tab_btn active" id="nav-starter-tab" data-bs-toggle="tab" data-bs-target="#nav-starters" type="button" role="tab" aria-controls="nav-starters" aria-selected="true"> ... </button> </div> <!-- Tabs content --> <div className="content_box overflow-hidden"> <div "content active" role="tabpanel" aria-labelledby="nav-starter-tab"> <div className="row m-0"> ... </div> ... </div> </div> </div>
Use React Video Modal
use your own videos into the video-section video tag
<div className="modal" >
...
<div className="modal-content">
<button className="video-overlay-close">
...
</button>
<iframe >
<video>
..
</video>
</iframe>
</div>
</div>
Helper Classes
We have created some really useful helper classes for you. Here are a few of them:
position-relative & h-100 & w-100- Width, height, position helperd-none & d-block & d-flex- Display helpertext-left & text-center & text-right- Text align helper.dark_head- set the title design use of .dark_head class-
.slider_shape_img1 & .slider_shape_img2 & .footer-area .background-shape1 img & .footer-area .background-shape2 img- set the background shapes. -
justify-content-center & justify-content-start & justify-content-end & justify-content-between & align-items-start & align-items-center & align-items-end & flex-column & flex-wrap & flex-1- Flex helper overflow-hidden- Overflow helpertext-uppercase & text-capitalize & text-normal- Text transform helper
Slider Types & their Options
Nairobi includes Sliders are mentioned as follows:
- Swiper Carousel
You can find the Swiper carousel slider-related Documentation here.
Read Swiper Sliders Docs
Introduction
Nairobi boasts of a many handy features which are quite powerful, flexible, functional & easy to use. Setting up features is very easy & Self Explanatory. Here is the List of features included :
SectionsAnimationsButtonsScrollingHeaderSwiper CarouselsCounterVideoServices contentResumePortfolioTabsTestimonialNewsFaq and PricingEmail SectionFormFooter
Each of the above mentioned features are easily extendable, flexible & easy to use. You can find the sample codes in their respective files. We are explaining a few of them for your Reference.
Animations
Scroll to reveal Animations are latest in the Trends. You can do them too with Bistro. You can use animations on any element you want. Here is the Sample Code:
.mobile_header.sticky {
animation: smoothScroll 1s forwards;
}
@keyframes smoothScroll {
0% {
transform: translateY(-40px);
}
100% {
transform: translateY(0px);
}
}
Slider Animation
.home-slider .slideshow.slick-active .slide-img{
animation: cssAnimation 8s 1 ease-in-out forwards;
}
@keyframes cssAnimation {
from {
-webkit-transform: scale(1) translate(0px);
}
to {
-webkit-transform: scale(1.1) translate(0px);
}
}
Rotate text Animation
.round-text > img {
animation-name: spin;
}
@keyframes spin {
from {
transform:rotate(360deg);
}
to {
transform:rotate(0deg);
}
}
<div className="wow fadeInDown" ></div>
You can also use delays for your Animations:
<div data-wow-duration="500ms" data-wow-delay="300ms"></div>
Note: Delay Duration is in milliseconds.
Here is the list of the Animation Types you can use:
bounceflashpulserubberBandshakeswingtadawobblebounceInbounceInDownbounceInLeftbounceInRightbounceInUpbounceOutbounceOutDownbounceOutLeftbounceOutRightbounceOutUpfadeInfadeInDownfadeInDownBigfadeInLeftfadeInLeftBigfadeInRightfadeInRightBigfadeInUpfadeInUpBigfadeOutfadeOutDownfadeOutDownBigfadeOutLeftfadeOutLeftBigfadeOutRightfadeOutRightBigfadeOutUpfadeOutUpBigflipflipInXflipInYflipOutXflipOutYlightSpeedInlightSpeedOutrotateInrotateInDownLeftrotateInDownRightrotateInUpLeftrotateInUpRightrotateOutrotateOutDownLeftrotateOutDownRightrotateOutUpLeftrotateOutUpRighthingerollInrollOutzoomInzoomInDownzoomInLeftzoomInRightzoomInUpzoomOutzoomOutDownzoomOutLeftzoomOutRightzoomOutUp
Images
- The Stocks
- Unsplash
- Freepik
- RaumRot
- Picjumbo
- Stockphotos.io
- Imcreator FREE
- Flickr CC-Search
- Mazwai (Stock Footage)
CSS & Fonts
style.css- use custom csshomeMedia.css- responsive media query css- Animation
- Swiper Carousel
- Google Fonts - use Jost and Montserrat